Skip to content

✨ Add file provider for kubeconfig on the filesystem #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

ntnn
Copy link
Contributor

@ntnn ntnn commented Jul 18, 2025

Adds a provider for kubeconfigs on the filesystem.

The name is a bit nondescript, but kubeconfig is already used by the provider reading kubeconfigs from secrets.

multicluster-runtime currently does not come with a way to pass or set a kubeconfig file for testing and this would fit that bill.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 18, 2025
@k8s-ci-robot k8s-ci-robot requested review from JeremyOT and sttts July 18, 2025 17:29
@k8s-ci-robot
Copy link
Contributor

Welcome @ntnn!

It looks like this is your first PR to kubernetes-sigs/multicluster-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/multicluster-runtime has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 18, 2025
@ntnn ntnn changed the title Add file provider for kubeconfig on the filesystem ✨ Add file provider for kubeconfig on the filesystem Jul 18, 2025
@ntnn ntnn force-pushed the file-provider branch 3 times, most recently from 3e22a25 to 89dc416 Compare July 21, 2025 10:09
Copy link

linux-foundation-easycla bot commented Aug 7, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: ntnn / name: Nelo-T. Wallus (04d1112)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Aug 7, 2025
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2025
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 7, 2025
@FourFifthsCode
Copy link
Contributor

@ntnn very cool provider!
cc @embik

I know its a bit late for this idea (a lot of work has went into this PR!), but what if you added this functionality to the existing kubeconfig provider?
Seems like there is a decent amount of similar code, the only main difference is where we watch for kubeconfig. If it doesn't make sense, that's totally cool.

Was thinking about maybe changing the kubeconfig provider options to use functions instead of config struct, then could be something like:

p, err := kubeconfig.New(
   kubeconfig.WithFileWatcher(fileWatchConfigs...),
   kubeconfig.WithSecretWatcher(secretWatchConfigs...)
)

What do you all think of that?

@ntnn
Copy link
Contributor Author

ntnn commented Aug 12, 2025

Hi @FourFifthsCode !

Thanks! Imho most overlap is how to engange/disengage clusters and that is common between all providers.

Personally I was hoping to keep providers simpler and to instead use a "meta" provider to use multiple providers.
That's why I PR'd the chain provider - however that comes with the problem of shadowing clusters if two clusters yield the same clusterName.
For that reason @embik and I landed on the multi provider, which prevents the shadowing but requires a prefix for each provider.

If a provider accepts multiple different sources the same problem arises and the clusterName would either have to be prefixed or just logging an error - which is what I currently do here in the file provider, but the file provider is only meant to make it possible to inject some kubeconfigs when working on a controller.

I think a library with a generic provider that handles the common management of engaging/disengaging clusters would be great to simplify writing further providers.

@FourFifthsCode
Copy link
Contributor

@ntnn yeah, I think what you said makes a lot of sense! Multi-provider and some more shared code sounds great!

Copy link
Member

@embik embik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

🎉

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 13, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f439f19e5a7fe22505f0b026f1e52f7c1a0fe4b9

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik, ntnn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 13, 2025
@k8s-ci-robot k8s-ci-robot merged commit a41032c into kubernetes-sigs:main Aug 13, 2025
18 checks passed
@ntnn ntnn deleted the file-provider branch August 13, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants